home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / ROUNDRCT.PAS < prev    next >
Pascal/Delphi Source File  |  1988-07-24  |  2KB  |  35 lines

  1. {->>>>RoundedRectangle<<<<-------------------------------------}
  2. {                                                              }
  3. { Filename : ROUNDRCT.SRC -- Last Modified 7/23/88             }
  4. {                                                              }
  5. { This routine draws a rectangle at X,Y; Width pixels wide and }
  6. { Height pixels high; with rounded corners of radius R.        }
  7. {                                                              }
  8. { The Graph unit must be USED for this procedure to compile.   }
  9. {                                                              }
  10. {     From: COMPLETE TURBO PASCAL 5.0  by Jeff Duntemann       }
  11. {    Scott, Foresman & Co., Inc. 1988   ISBN 0-673-38355-5     }
  12. {--------------------------------------------------------------}
  13.  
  14. PROCEDURE RoundedRectangle(X,Y,Width,Height,R : Word);
  15.  
  16. VAR
  17.   ULData,LLData,LRData,URData : ArcCoordsType;
  18.  
  19. BEGIN
  20.   { First we draw each corner arc and save its coordinates: }
  21.   Arc(X+R,Y+R,90,180,R);
  22.   GetArcCoords(ULData);
  23.   Arc(X+R,Y+Height-R,180,270,R);
  24.   GetArcCoords(LLData);
  25.   Arc(X+Width-R,Y+Height-R,270,360,R);
  26.   GetArcCoords(LRData);
  27.   Arc(X+Width-R,Y+R,0,90,R);
  28.   GetArcCoords(URData);
  29.   { Next we draw the four connecting lines: }
  30.   Line(ULData.XEnd,ULData.YEnd,LLData.XStart,LLData.YStart);
  31.   Line(LLData.XEnd,LLData.YEnd,LRData.XStart,LRData.YStart);
  32.   Line(LRData.XEnd,LRData.YEnd,URData.XStart,URData.YStart);
  33.   Line(URData.XEnd,URData.YEnd,ULData.XStart,ULData.YStart);
  34. END;
  35.